<template>
<transition name="slide">
  <div class="modal" v-show="showModal">
    <div class="mask"></div>
    <div class="modal-dialog">
      <div class="modal-header">
        <span>{{title}}</span>
        <a href="javascrpit:;" class="icon-close" @click="$emit('cancel')"></a>
      </div>
      <div class="modal-body">
        <slot name="body"></slot>
      </div>
      <div class="modal-footer">
        <a href="javascrpit:;" class="btn" v-if="btnType==1" @click="$emit('submit')">{{sureText}}</a>
        <a href="javascrpit:;" class="btn" v-if="btnType==2" @click="$emit('cancel')">{{cancelText}}</a>
        <div class="btn-group" v-if="btnType==3">
          <a href="javascrpit:;" class="btn" @click="$emit('submit')">{{sureText}}</a>
          <a href="javascrpit:;" class="btn btn-default"  @click="$emit('cancel')">{{cancelText}}</a>
        </div>
      </div>
    </div>
  </div>
  </transition>
</template>

<script>
//import x from ''
export default {
  name: "modal",
  props:{
    // 弹框类型：小small,中middle,大large,表单
    modalType:{
      type:String,
      default:'form'
    },
    // 弹框标题
    title:String,
    // 按钮类型：1：只有确定按钮 2：取消按钮 3：确定取消
    btnType:String,
    sureText:{
      type:String,
      default:'确定'
    },
    cancelText:{
      type:String,
      default:'取消'
    },
    showModal:Boolean
  },
  components: {},
  data() {
    return {};
  },
  computed: {},
  methods: {},
  mounted() {},
  beforeCreate() {}, //生命周期 - 创建之前
  beforeMount() {}, //生命周期 - 挂载之前
  beforeUpdate() {}, //生命周期 - 更新之前
  updated() {}, //生命周期 - 更新之后
  beforeDestroy() {}, //生命周期 - 销毁之前
  destroyed() {}, //生命周期 - 销毁完成
  activated() {} //如果页面有keep-alive缓存功能，这个函数会触发
};
</script>

<style lang='scss'>
@import "./../assets/scss/mixin.scss";
@import "./../assets/scss/config.scss";
@import "./../assets/scss/modal.scss";
</style>